home *** CD-ROM | disk | FTP | other *** search
/ Painter Bear's Language Bridge — Italian / Bridge_ponte_itialian.iso / pc / helpers / open.dxr / 00012_button handlers.ls < prev    next >
Encoding:
Text File  |  2001-02-22  |  5.7 KB  |  172 lines

  1. on initializeBtnHilites
  2.   global gCurrBtnSprite, gCurrBtnMember
  3.   set gCurrBtnSprite to EMPTY
  4.   set gCurrBtnMember to EMPTY
  5. end
  6.  
  7. on hiliteBtn whichCast, whichBtn
  8.   global gCurrBtnSprite, gCurrBtnMember, gcurrCastLib, gHilitedBtn, gDontHilite, gSndPath
  9.   clearBtnHilite()
  10.   if whichCast = VOID then
  11.     set currCastLib to "buttons"
  12.   else
  13.     set currCastLib to whichCast
  14.   end if
  15.   if whichBtn = VOID then
  16.     set gCurrBtnSprite to the clickOn
  17.   else
  18.     set gCurrBtnSprite to whichBtn
  19.   end if
  20.   set gCurrBtnMember to the memberNum of sprite gCurrBtnSprite
  21.   set whiteBtn to the name of cast gCurrBtnMember of castLib currCastLib
  22.   set gHilitedBtn to whiteBtn
  23.   put "down" into word the number of words in whiteBtn of whiteBtn
  24.   set the memberNum of sprite gCurrBtnSprite to the number of member whiteBtn
  25.   set gDontHilite to gCurrBtnSprite
  26.   if (whiteBtn contains "quit") or (whiteBtn contains "back") or (whiteBtn contains "help") or (whiteBtn contains "music") or (whiteBtn contains "switch") then
  27.     set whichClick to random(14)
  28.     puppetSound(2, "fart" & whichClick)
  29.   else
  30.     set whichClick to random(13)
  31.     puppetSound(2, "click" & whichClick)
  32.     updateStage()
  33.   end if
  34. end
  35.  
  36. on clearBtnHilite
  37.   global gCurrBtnSprite, gCurrBtnMember, gHilitedBtn, gDontHilite
  38.   if (gCurrBtnSprite <> EMPTY) and (gCurrBtnMember <> EMPTY) then
  39.     put "up" into word the number of words in gHilitedBtn of gHilitedBtn
  40.     set the memberNum of sprite gCurrBtnSprite to the number of member gHilitedBtn
  41.     updateStage()
  42.     set gCurrBtnMember to EMPTY
  43.     set gDontHilite to VOID
  44.   end if
  45. end
  46.  
  47. on rllovr whichSprite, whichCast
  48.   if whichCast = VOID then
  49.     set whichCast to "buttons"
  50.   end if
  51.   set foo to the memberNum of sprite whichSprite
  52.   set grayBtn to the name of member foo of castLib whichCast
  53.   put "over" into word the number of words in grayBtn of grayBtn
  54.   set the memberNum of sprite whichSprite to the number of member grayBtn
  55. end
  56.  
  57. on undoRllovr whichSprite, whichCast
  58.   if whichCast = VOID then
  59.     set whichCast to "buttons"
  60.   end if
  61.   set foo to the memberNum of sprite whichSprite
  62.   set grayBtn to the name of member foo of castLib whichCast
  63.   if word 2 of grayBtn <> "off" then
  64.     put "up" into word the number of words in grayBtn of grayBtn
  65.   end if
  66.   set the memberNum of sprite whichSprite to the number of member grayBtn
  67. end
  68.  
  69. on ghostBuster whichCast
  70.   global gCurrBtnSprite, gCurrBtnMember, gMusOn
  71.   if whichCast = VOID then
  72.     set whichCast to "shared"
  73.   end if
  74.   set foo to the memberNum of sprite the clickOn
  75.   set grayBtn to the name of member foo of castLib whichCast
  76.   if word 2 of grayBtn = "off" then
  77.     put "up" into word the number of words in grayBtn of grayBtn
  78.     set gMusOn to 1
  79.   else
  80.     put "off" into word the number of words in grayBtn of grayBtn
  81.     sound stop 3
  82.     set gMusOn to 0
  83.     unloadMember(member "peppy")
  84.   end if
  85.   set the memberNum of sprite the clickOn to the number of member grayBtn
  86.   set gCurrBtnSprite to EMPTY
  87.   set gCurrBtnMember to EMPTY
  88. end
  89.  
  90. on flashBtn whichSprite, flashRate, firstState, secondState, whichCast
  91.   global gDontHilite
  92.   if (gDontHilite <> whichSprite) and ((the ticks mod flashRate) = 0) then
  93.     if whichCast = VOID then
  94.       set whichCast to "buttons"
  95.     end if
  96.     set whichBtn to the memberNum of sprite whichSprite
  97.     set whiteBtn to the name of member whichBtn of castLib whichCast
  98.     if word the number of words in whiteBtn of whiteBtn <> firstState then
  99.       put firstState into word the number of words in whiteBtn of whiteBtn
  100.     else
  101.       put secondState into word the number of words in whiteBtn of whiteBtn
  102.     end if
  103.     set the memberNum of sprite whichSprite to the number of member whiteBtn
  104.     updateStage()
  105.   end if
  106. end
  107.  
  108. on grayOutButtons whereToStart, whereToStop, whichCast
  109.   global gCanAcceptKey
  110.   if whichCast = VOID then
  111.     set whichCast to "buttons"
  112.   end if
  113.   repeat with X = whereToStart to whereToStop
  114.     set Y to the memberNum of sprite X
  115.     set grayBtn to the name of member Y of castLib whichCast
  116.     set gOriginalButton to grayBtn
  117.     put "gray" into word the number of words in grayBtn of grayBtn
  118.     set the memberNum of sprite X to the number of member grayBtn
  119.   end repeat
  120.   updateStage()
  121. end
  122.  
  123. on BringBackButtons whereToStart, whereToStop, whichCast
  124.   global gCanAcceptKey
  125.   if whichCast = VOID then
  126.     set whichCast to "buttons"
  127.   end if
  128.   repeat with X = whereToStart to whereToStop
  129.     set Y to the memberNum of sprite X
  130.     set grayBtn to the name of member Y of castLib whichCast
  131.     set gOriginalButton to grayBtn
  132.     put "up" into word the number of words in grayBtn of grayBtn
  133.     set the memberNum of sprite X to the number of member grayBtn
  134.   end repeat
  135.   updateStage()
  136. end
  137.  
  138. on hiliteArrows whichCast, whichBtn
  139.   global gCurrBtnSprite, gCurrBtnMember, gcurrCastLib, gHilitedBtn, gDontHilite, gSndPath
  140.   if whichCast = VOID then
  141.     set currCastLib to "buttons"
  142.   else
  143.     set currCastLib to whichCast
  144.   end if
  145.   if whichBtn = VOID then
  146.     set currBtnSpt to the clickOn
  147.   else
  148.     set currBtnSpt to whichBtn
  149.   end if
  150.   set foo to the name of member the memberNum of sprite currBtnSpt of castLib currCastLib
  151.   put "down" into word the number of words in foo of foo
  152.   set the memberNum of sprite currBtnSpt to the number of member foo
  153.   updateStage()
  154. end
  155.  
  156. on rllovrTitle whichSprite, whichCastLib
  157.   global gLangSelect, gLangDirect, gTitleSpt
  158.   set foo to the name of member the memberNum of sprite whichSprite of castLib whichCastLib
  159.   set whichLabel to word 1 of foo
  160.   if gLangDirect = 1 then
  161.     set whichLang to "e"
  162.   else
  163.     set whichLang to gLangSelect
  164.   end if
  165.   set the memberNum of sprite gTitleSpt to the number of member (whichLang && whichLabel & " title")
  166. end
  167.  
  168. on undoRllovrTitle
  169.   global gTitleSpt
  170.   set the memberNum of sprite gTitleSpt to the number of member "blank title"
  171. end
  172.